echo "* soft nofile 2100000" >> /etc/security/limits.conf
echo "* hard nofile 2100000" >> /etc/security/limits.conf
echo "root hard nofile 2100000" >> /etc/security/limits.conf
echo "root soft nofile 2100000" >> /etc/security/limits.conf

echo "fs.file-max = 20000000" >> /etc/sysctl.conf
echo "fs.nr_open = 20000000" >> /etc/sysctl.conf

echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf
echo "net.ipv4.tcp_mem = 786432 2097152 3145728" >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 4096 16777216" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 4096 16777216" >> /etc/sysctl.conf

echo "net.nf_conntrack_max=2048576" >> /etc/sysctl.conf

echo "net.core.somaxconn = 10240" >> /etc/sysctl.conf

echo "net.ipv4.tcp_max_syn_backlog = 16384" >> /etc/sysctl.conf
echo "net.ipv4.tcp_syncookies = 0" >> /etc/sysctl.conf
echo "net.core.netdev_max_backlog = 41960" >> /etc/sysctl.conf

echo "net.ipv4.tcp_max_tw_buckets = 300000" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle = 1" >> /etc/sysctl.conf

echo "net.ipv4.tcp_fin_timeout = 10" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_orphans = 131072 " >> /etc/sysctl.conf
echo "net.core.optmem_max = 819200" >> /etc/sysctl.conf

echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 16777216 " >> /etc/sysctl.conf
echo "net.core.wmem_max = 16777216" >> /etc/sysctl.conf

# echo "" >> /etc/sysctl.conf

sysctl -p
